package org.summerframework.component.security.config;

import org.summerframework.component.security.security.service.DefaultRoleService;
import org.summerframework.component.security.security.service.impl.DefaultRoleServiceImpl;
import org.summerframework.component.security.session.config.HttpSessionConfig;
import org.summerframework.web.config.WebConfiguration;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Repository;

/**
 * @author 石超
 * @version v1.0.0
 */
@Configuration
@ComponentScan({
        "org.summerframework.component.security.*.service",
        "org.summerframework.component.security.*.controller"
})
@MapperScan(value = "org.summerframework.component.security.*.model",
        annotationClass = Repository.class)
@AutoConfigureBefore({HttpSessionConfig.class, WebConfiguration.class})
public class SecurityRoleConfiguration {

    @Bean
    @ConditionalOnMissingBean(DefaultRoleService.class)
    public DefaultRoleService authenticationService() {
        return new DefaultRoleServiceImpl();
    }
}
